<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 通过回调函数解决异步的问题
        var a = 0;
        function b(v) {
            console.log(v);
        }
        function fn(t, bbb) {
            // setTimeout延迟执行 t是延迟的事件 单位是ms  1000ms = 1s
            setTimeout(function() {
                a = 3;
                bbb(a)
            }, t)
        }

        fn(2000, b)
    </script>
</body>
</html>